package com.mvu.banana.common.server;

import com.mvu.banana.common.client.ServiceToken;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by IntelliJ IDEA.
 * User: gantz
 * Date: 5/29/11
 * Time: 9:42 PM
 * To change this template use File | Settings | File Templates.
 */
public class SessionManagerMock implements ISessionManager{
  private ServiceToken serviceToken;

  public static SessionManagerMock get() {
    SessionManagerMock mock = new SessionManagerMock();
    SessionManager.INSTANCE = mock;
    return mock;
  }

  public void login(String username){
    serviceToken  = new ServiceToken();
    serviceToken.setUsername(username);
  }

  @Override
  public ServiceToken getServiceToken(HttpServletRequest request) {
    return serviceToken;
  }

  @Override
  public ServiceToken login(HttpServletRequest request) {
    return serviceToken;
  }

  @Override
  public void logout(HttpServletRequest request) {
  }

}
